package com.fcgzs;

import org.csource.fastdfs.*;

/**
 * @Auther: ljj
 * @Description:
 */
public class TestFastDFS {

    public static void main(String[] args)throws Exception {
        //1.加载配置文件，读取调度服务器的地址
        ClientGlobal.init("C:\\0622\\yigoushangcheng-parent\\yigoushangcheng-service\\yigoushangcheng-file-service\\src\\main\\resources\\fdfs_client.conf");
        //2.创建调度服务器的客户端对象，直接new
        TrackerClient trackerClient = new TrackerClient();
        //3.创建调度服务器的服务端对象，使用客户端对象创建
        TrackerServer trackerServer = trackerClient.getConnection();
        //4.创建存储服务器的服务端对象，声明为null
        StorageServer storageServer = null;
        //5.创建存储服务器的客户端对象
        StorageClient storageClient = new StorageClient(trackerServer,storageServer);
        //6.使用存储服务器的客户端对象完成上传，并返回文件存储地址
        String[] strings = storageClient.upload_file("C:\\1.jpg", "jpg", null);

        for (String url : strings) {
            System.out.println(url);
        }

    }
}
